package com.dc.ftp.activity.loan;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.bigkoo.pickerview.OptionsPopupWindow;
import com.dc.ftp.R;
import com.dc.ftp.base.SPBaseActivity;
import com.dc.ftp.utils.PickerViewUtil;
import com.dc.ftp.utils.SystemApi;
import com.dc.ftp.view.address_popwindow.PopHelper;

import java.util.ArrayList;


public class PersonalInfoActivity extends SPBaseActivity implements View.OnClickListener{

    private SwipeRefreshLayout swipeRefreshLayout;
    private PopHelper popHelper;
    private TextView tvAddress;
    private TextView tvEducation;
    private OptionsPopupWindow mPop;
    private ArrayList<String> mListEducation;
    private ArrayList<String> mListHouse;
    private ArrayList<String> mListMarriage;
    private ArrayList<String> mListChildren;
    private TextView tvHouse;
    private TextView tvMarriage;
    private TextView tvChildren;
    private View parentView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_personal_info);
        super.init();
        setHeadTitle(true,"个人信息");
    }

    @Override
    public void initView() {
         parentView = findViewById(R.id.activity_personal_info);

        swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
        swipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.color_tab_item_fous));
       findViewById(R.id.lly_address).setOnClickListener(this);
         tvAddress = (TextView) findViewById(R.id.tv_address);
        findViewById(R.id.lly_education).setOnClickListener(this);
        tvEducation = (TextView) findViewById(R.id.tv_education);
        findViewById(R.id.lly_house).setOnClickListener(this);
        tvHouse = (TextView) findViewById(R.id.tv_house);
        findViewById(R.id.lly_marriage).setOnClickListener(this);
        tvMarriage = (TextView) findViewById(R.id.tv_marriage);
        findViewById(R.id.lly_children).setOnClickListener(this);
        tvChildren = (TextView) findViewById(R.id.tv_children);
    }

    @Override
    public void initData() {
        mListEducation = new ArrayList<>();
        mListEducation.add("专科");
        mListEducation.add("本科");
        mListEducation.add("硕士");
        mListEducation.add("博士");
        mListEducation.add("高中");
        mListEducation.add("初中");

        mListHouse = new ArrayList<>();
        mListHouse.add("自购有按揭");
        mListHouse.add("自购无按揭");
        mListHouse.add("亲属楼宇");
        mListHouse.add("集体宿舍");
        mListHouse.add("自建房");
        mListHouse.add("租房");
        mListHouse.add("共有");
        mListHouse.add("其他");

        mListMarriage = new ArrayList<>();

        mListMarriage.add("未婚");
        mListMarriage.add("已婚");
        mListMarriage.add("离异");
        mListMarriage.add("丧偶");

        mListChildren = new ArrayList<>();
        mListChildren.add("0个");
        mListChildren.add("1个");
        mListChildren.add("2个");
        mListChildren.add("3个");
        mListChildren.add("4个及以上");

    }

    @Override
    public void initEvent() {
        //设置下拉刷新
        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {

                swipeRefreshLayout.setRefreshing(false);

            }
        });


    }




    @Override
    public void onClick(View v) {

        switch (v.getId()){
            case R.id.lly_address:
                PickerViewUtil.showAddressPickerView(this,parentView,tvAddress);
                break;
            case R.id.lly_education:
                PickerViewUtil.initPickerView(this,parentView,true,"选择学历",mListEducation,tvEducation);
                break;
            case R.id.lly_house:
                PickerViewUtil.initPickerView(this,parentView,true,"选择住房",mListHouse,tvHouse);
                break;
            case R.id.lly_marriage:
                PickerViewUtil.initPickerView(this,parentView,true,"选择婚姻状态",mListMarriage,tvMarriage);
                break;
            case R.id.lly_children:
                PickerViewUtil.initPickerView(this,parentView,true,"选择子女数",mListChildren,tvChildren);
                break;

            default:break;

        }
    }






}
